<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title></title>
<meta name="decorator" content="default" />
<style type="text/css">
.form-horizontal .control-label {
	float: left;
	width: 80px;
	padding-top: 5px;
	text-align: right;
}

.form-horizontal .controlgroup {
	*padding-right: 20px;
	*display: inline-block;
	margin-left: 100px;
	*margin-left: 0;
}
</style>
</head>
<body>
	<div class="container">
		<tags:message content="${message}" />
		<div class="icon-buttons">
			<input type="button" data-inline="true" data-icon="back"
				onclick="return directOpenURL('${ctx}/cash/oldcard/cards/add/cardTimesPage')"
				data-iconpos="notext" value="返回" />
		</div>
		<form:form method="post" id="inputForm"
			action="${ctx}/cash/oldcard/cards/add/cardTimes"
			modelAttribute="cardForm">

			<form:hidden path="memberID" />
			<form:hidden path="templateID" />
			<div data-role="fieldcontain">
				<label>卡名</label>
				<form:input type="text" readonly="true" path="cardName" />
			</div>

			<div data-role="fieldcontain">
				<label>护理项目</label>
				<form:input type="text" readonly="true" path="careName" />
			</div>
			<div data-role="fieldcontain">
				<label>护理间隔(天)</label>
				<form:input type="text" readonly="true" path="careDuration" />
			</div>

			<div data-role="fieldcontain">
				<label>剩余次数(次)</label>
				<form:input type="text" path="cardTimes" />
			</div>

			<div data-role="fieldcontain">
				<label>卡内余额(元)</label>
				<form:input type="text" path="retailPrice" />
			</div>
			<div id="okbutton">
				<input type="submit" data-inline="true" value="确认添加" />
			</div>
		</form:form>
	</div>
	<script type="text/javascript">
		$(document).ready(
				function() {
					$("#inputForm").validate(
							{
								submitHandler : function(form) {
									bossPasswordPopup(function() {
										global.confirm("确认开卡【"
												+ $('#cardName').val()
												+ "】, 剩余 "
												+ $('#cardTimes').val()
												+ "次 , 卡内余额 "
												+ $('#retailPrice').val()
												+ "元？", function() {
											form.submit();
										});//confirm
									});
								},
								focusInvalid : false,
								rules : {
									cardTimes : {
										required : true,
										digits : true,
										min : 1,
										max : 100,
									},
									retailPrice : {
										ifMoney : '#retailPrice',
										required : true,
										number : true,
										min : 1,
										max : 1000000,
									}

								},
								errorContainer : "#messageBox",
								errorPlacement : function(error, element) {
									$("#messageBox").text("输入有误，请先更正。");
									if (element.is(":checkbox")
											|| element.is(":radio")) {
										error.appendTo(element.parent()
												.parent());
									} else {
										error.insertAfter(element);
									}
								},
								messages : {}
							});//validate
					disableExitMenu();

				});
		function page(n, s) {
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
			return false;
		}
	</script>
</body>
</html>
